BITS 32
%include "macrosmodoprotegido.mac"

extern fin_intr_pic1


global _isr0
_isr0:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int0_len
	MOV ESI, int0
	MOV EDI, 0
	MOV AH, 0x8A
ciclo0:
	LODSB
	STOSW
	LOOP ciclo0
	jmp $

global _isr1
_isr1:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int1_len
	MOV ESI, int1
	MOV EDI, 0
	MOV AH, 0x8A
ciclo1:
	LODSB
	STOSW
	LOOP ciclo1
	jmp $

global _isr2
_isr2:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int2_len
	MOV ESI, int2
	MOV EDI, 0
	MOV AH, 0x8A
ciclo2:
	LODSB
	STOSW
	LOOP ciclo2
	jmp $
	
	
	
	
global _isr3
_isr3:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int3_len
	MOV ESI, int3
	MOV EDI, 0
	MOV AH, 0x8A
ciclo3:
	LODSB
	STOSW
	LOOP ciclo3
	jmp $
	
global _isr4
_isr4:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int4_len
	MOV ESI, int4
	MOV EDI, 0
	MOV AH, 0x8A
ciclo4:
	LODSB
	STOSW
	LOOP ciclo4
	jmp $
	
global _isr5
_isr5:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int5_len
	MOV ESI, int5
	MOV EDI, 0
	MOV AH, 0x8A
ciclo5:
	LODSB
	STOSW
	LOOP ciclo5
	jmp $
	
	
global _isr6
_isr6:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int6_len
	MOV ESI, int6
	MOV EDI, 0
	MOV AH, 0x8A
ciclo6:
	LODSB
	STOSW
	LOOP ciclo6
	jmp $
	
global _isr7
_isr7:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int7_len
	MOV ESI, int7
	MOV EDI, 0
	MOV AH, 0x8A
ciclo7:
	LODSB
	STOSW
	LOOP ciclo7
	jmp $
	
global _isr8
_isr8:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int8_len
	MOV ESI, int8
	MOV EDI, 0
	MOV AH, 0x8A
ciclo8:
	LODSB
	STOSW
	LOOP ciclo8
	jmp $
	
global _isr9
_isr9:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int9_len
	MOV ESI, int9
	MOV EDI, 0
	MOV AH, 0x8A
ciclo9:
	LODSB
	STOSW
	LOOP ciclo9
	jmp $
	
global _isr10
_isr10:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int10_len
	MOV ESI, int10
	MOV EDI, 0
	MOV AH, 0x8A
ciclo10:
	LODSB
	STOSW
	LOOP ciclo10
	jmp $

global _isr11
_isr11:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int11_len
	MOV ESI, int11
	MOV EDI, 0
	MOV AH, 0x8A
ciclo11:
	LODSB
	STOSW
	LOOP ciclo11
	jmp $
	

	
global _isr12
_isr12:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int12_len
	MOV ESI, int12
	MOV EDI, 0
	MOV AH, 0x8A
ciclo12:
	LODSB
	STOSW
	LOOP ciclo12
	jmp $
	
	
	
global _isr13
_isr13:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int13_len
	MOV ESI, int13
	MOV EDI, 0
	MOV AH, 0x8A
ciclo13:
	LODSB
	STOSW
	LOOP ciclo13
	jmp $

	
global _isr14
_isr14:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int14_len
	MOV ESI, int14
	MOV EDI, 0
	MOV AH, 0x8A
ciclo14:
	LODSB
	STOSW
	LOOP ciclo14
	jmp $
	
global _isr15
_isr15:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int15_len
	MOV ESI, int15
	MOV EDI, 0
	MOV AH, 0x8A
ciclo15:
	LODSB
	STOSW
	LOOP ciclo15
	jmp $
	
global _isr16
_isr16:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int16_len
	MOV ESI, int16
	MOV EDI, 0
	MOV AH, 0x8A
ciclo16:
	LODSB
	STOSW
	LOOP ciclo16
	jmp $
	
global _isr17
_isr17:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int17_len
	MOV ESI, int17
	MOV EDI, 0
	MOV AH, 0x8A
ciclo17:
	LODSB
	STOSW
	LOOP ciclo17
	jmp $
	
global _isr18
_isr18:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int18_len
	MOV ESI, int18
	MOV EDI, 0
	MOV AH, 0x8A
ciclo18:
	LODSB
	STOSW
	LOOP ciclo18
	jmp $
	
	
	
global _isr19
_isr19:
	MOV AX, 0x20
	MOV ES, AX
	MOV ECX, int19_len
	MOV ESI, int19
	MOV EDI, 0
	MOV AH, 0x8A
ciclo19:
	LODSB
	STOSW
	LOOP ciclo19
	jmp $
	
	
	
	
proximo_reloj:
	pushad
	inc DWORD [isrnumero]
	mov ebx, [isrnumero]
	cmp ebx, 0x4
	jl .ok
		mov DWORD [isrnumero], 0x0
		mov ebx, 0
	.ok:
		add ebx, isrmensaje1
		mov edx, isrmensaje
		IMPRIMIR_TEXTO edx, 6, 0x0A, 24, 73
		IMPRIMIR_TEXTO ebx, 1, 0x0A, 24, 79
	popad
	ret
	
isrmensaje: db 'Clock:'
isrnumero: dd 0x00000000
isrmensaje1: db '|'
isrmensaje2: db '/'
isrmensaje3: db '-'
isrmensaje4: db '\'


int0: db 'ERROR: Division por 0 - Fault'
int0_len: equ $ - int0

int1: db 'ERROR: Reservado - Fault/Trap'
int1_len: equ $ - int1


int2: db 'ERROR: NMI Interrupt - Interrupt'
int2_len: equ $ - int2


int3: db 'ERROR: Breackpoint - Trap'
int3_len: equ $ - int3

int4: db 'ERROR: Overflow - Trap'
int4_len: equ $ - int4

int5: db 'ERROR: BOUND Range Exceeded - Fault'
int5_len: equ $ - int5

int6: db 'ERROR: Invalid Opcode - Fault'
int6_len: equ $ - int6

int7: db 'ERROR: Device Not Available - Fault'
int7_len: equ $ - int7

int8: db 'ERROR: Double Fault - Abort'
int8_len: equ $ - int8

int9: db 'ERROR: Coprocessor Segment Overrun (Reserved) - Fault'
int9_len: equ $ - int9

int10: db 'ERROR: Invalid TSS - Fault'
int10_len: equ $ - int10

int11: db 'ERROR: Segment Not Present - Fault'
int11_len: equ $ - int11

int12: db 'ERROR: Stack-Segment Fault - Fault'
int12_len: equ $ - int12

int13: db 'ERROR: General Protection - Fault'
int13_len: equ $ - int13

int14: db 'ERROR: Page fault - Fault'
int14_len: equ $ - int14

int15: db 'ERROR: Intel Reserved. Do Not Use - Fault'
int15_len: equ $ - int15

int16: db 'ERROR: x87 FPU Floating-Point Error (Math Fault) - Fault'
int16_len: equ $ - int16

int17: db 'ERROR: Aligment Check - Fault'
int17_len: equ $ - int17

int18: db 'ERROR: Machine Check . Abort'
int18_len: equ $ - int18

int19: db 'ERROR: SIMD Floating-Point Exception - Fault'
int19_len: equ $ - int19

